1. Field of the Invention
The present invention relates to storage subsystem target devices and, more specifically, relates to methods and associated structure for automatically switching and selecting from among a plurality of contexts within a target device having the ability to process multiple command contexts.
2. Discussion of Related Art
A storage subsystem includes one or more storage devices for the persistent storage of information. The information and structure relating to the information storage is typically provided to the storage devices by a host computer system (or other storage management device) through an I/O adapter. As used herein, initiator device refers to the host computer system and/or its associated I/O adapter. The target device, as used herein, refers to a selected one of the storage devices to which the initiator device directs an I/O request. The bus over which the initiator and target device communicate is referred to herein as the host channel.
The initiator/target device terminology is common to a standard bus known as Small Computer System Interface (hereinafter SCSI)--a popular electronic bus used to interconnect computers and peripheral devices. However, the problems known in the prior art discussed herein below and the solutions provided thereto by the present invention are common to any of several well known host channel media and architectures, including but not limited to: Fibre Channel, SSA, IPI, IDE, EIDE, and others. For simplicity, the problems and solutions thereto addressed by the present invention are presented herein in the context of a SCSI host channel connection. However, one of ordinary skill in the art will readily recognize that the problems and solutions addressed herein are applicable to other host channel environments.
The SCSI bus has become a common choice for connecting computing devices (through a SCSI adapter in the computer system) to storage peripheral devices such as disk drives, tape drives, disk arrays, and other storage and peripheral I/O devices. The specifications for the SCSI standards for the bus and the information exchanged thereon are publicly available in several forms including the ANSI publication SCSI 2 Standards Document X3T9.2/375R revision 10 L. Under the SCSI specifications, each device attached to the SCSI bus has a unique ID value by which it is identified on the SCSI bus. An initiator device initiates an I/O request to an identified target device and transfers any required data by asserting control over the SCSI bus (if available) and directing one or more commands to the identified target device. In general, the target device performs the requested operation and returns information. The returned information may comprise simple sense or status information, or may comprise, for example, data retrieved from a mass storage peripheral device.
A disk drive stores and retrieves data via control circuits and methods (an embedded controller) which command the head disk assembly (HDA) to perform the required physical storage and retrieval of information on the magnetic or optical medium. The interface within the controller to the HDA is referred to herein as the disk channel or formatter. Typically the data transfer bandwidth across the host channel is significantly greater than the bandwidth on the disk channel.
A significant portion of the bandwidth of the host channel may be idle while the disk drive (or other SCSI peripheral device) attempts to process the I/O request via interaction with the actuator through the slower disk channel. Standard SCSI disconnect and reconnect protocols will permit other devices to utilize the SCSI bus during this period. If no other initiator/target connection is established, the host channel will remain idle while the disconnected target device processes the request. Rather, the initiator simply awaits completion of the initiated command (when the target re-selects the initiator) before further interacting with that same target device.
Though the target device is incapable of responding to the first initiated command sequence, typical target devices also fail to respond to other commands which could be processed without requiring use of the busy disk channel. Target devices, in accordance with the SCSI standards, are often therefore referred to as single-threaded in the sense that they enforce a restriction that only a single command (a single thread) can be processed at a given time. This single-threaded architecture may therefore tend to underutilize the high speed host channel and thereby extend the latency of other queued commands.
A solution proposed in co-pending, patent application Ser. No. 96-064,068 provides for the processing of multiple commands within a target device in order to improve utilization of resources within the target device. In particular, multiple host commands may be processed each in a unique context containing all parameters relevant to the processing of that command. One command, the active context, is processed at a time. However, when processing of the active context underutilizes the resources of the target device, another command, one or a plurality of inactive contexts, is swapped with the active context to better utilize resources of the target device.
However, selecting an inactive context from among a plurality of such contexts and switching (or swapping) the active context with the selected inactive context must occur rapidly. Intervention by a general purpose processor programmed to perform such selection and swapping of contexts may be too slow to achieve the desired performance goals. For example, swapping the presently active context with a new context for a write command for which the host channel will imminently receive data may require very rapid response to avoid loss of the received data from the host channel. Or, for example, when the disk channel is operating independent of the host channel context which initiated its operation and the disk channel requires additional interaction with the host channel to exchange additional data blocks, the response must be rapid enough to avoid stopping the disk channel for lack of host channel interaction.